package maiyatian.videolive.live.Activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;

import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.ViewInject;
import org.xutils.x;

import java.util.ArrayList;
import java.util.List;

import maiyatian.videolive.IActivity;
import maiyatian.videolive.R;
import maiyatian.videolive.bean.LiveBean;
import maiyatian.videolive.live.FloatActivity.EnjoyerCardActivity;
import maiyatian.videolive.live.LiveBoxActivity;
import maiyatian.videolive.live.adapter.LookCommentAdapter;
import maiyatian.videolive.live.adapter.LookListAdapter;
import maiyatian.videolive.live.fragment.OverLiveLiverFragment;

/**
 * 作者：王中阳 on 2016/5/15 14:17
 * 邮箱：wangzhongyang@maiyatian.com
 * QQ(微信):425772719
 * 公司：北京麦芽田网络科技有限公司
 */
// TODO: 2016/5/17  歌词的UI 点击搜索歌曲的UI  
@ContentView(R.layout.activity_rec)
public class LiveRECActivity extends IActivity implements View.OnClickListener, LookListAdapter.IClickListener {
    public static final String TAG = "LiveRECActivity";
    //围观列表
    @ViewInject(R.id.rvLook)
    RecyclerView rvLook;
    List<LiveBean> datas;
    LookListAdapter lookListAdapter;
    //评论列表
    @ViewInject(R.id.rvLookComment)
    RecyclerView rvLookComment;
    LookCommentAdapter lookCommentAdapter;
    //底部工具栏
    View includeBottom;
    ImageView talk, message, music, camera;
    @ViewInject(R.id.ivOver)
    ImageView ivOver;


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        x.view().inject(this);
        ivOver.setOnClickListener(this);
        initViews();
    }

    private void initViews() {
        //围观列表
        rvLook.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
        datas = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            datas.add(new LiveBean());
        }
        lookListAdapter = new LookListAdapter(this, this);
        rvLook.setAdapter(lookListAdapter);
        lookListAdapter.setMdatas(datas);
        //评论列表
        rvLookComment.setLayoutManager(new LinearLayoutManager(this));
        lookCommentAdapter = new LookCommentAdapter(this);
        rvLookComment.setAdapter(lookCommentAdapter);
        lookCommentAdapter.setMdatas(datas);
        //底部工具栏
        includeBottom = findViewById(R.id.includeBottom);
        talk = (ImageView) includeBottom.findViewById(R.id.talk);
        talk.setOnClickListener(this);
        message = (ImageView) includeBottom.findViewById(R.id.message);
        message.setOnClickListener(this);
        music = (ImageView) includeBottom.findViewById(R.id.music);
        music.setOnClickListener(this);
        camera = (ImageView) includeBottom.findViewById(R.id.camera);
        camera.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.ivOver:
                Intent intent = new Intent();
                intent.setClass(this, LiveBoxActivity.class);
                intent.putExtra(IActivity.PAGETO, OverLiveLiverFragment.TAG);
                startActivity(intent);
                break;
            case R.id.talk:

                break;
            case R.id.message:

                break;
            case R.id.music:

                break;
            case R.id.camera:
// TODO: 2016/5/15 弹出闪光灯等选项 仿照送礼物的选择数量
                break;
        }
    }

    //围观人列表
    @Override
    public void onItemClicked(int position) {
        Intent intent = new Intent();
        intent.setClass(this, EnjoyerCardActivity.class);
        startActivity(intent);
    }
}
